<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>promise介绍及基本使用</title>
</head>
<body>
<script>
    //实例化 Promise对象
    const p = new Promise(function (resovle,reject){
        setTimeout(function (){
            //
            // let data = '数据库中用户数据';
            // resovle(data);
            let arr = '数据读取失败';
            reject(arr);
        },1000)
    });

    //调用promise对象的then方法
    p.then(function (value){
        console.log(value)
    },function (reason){
        console.log(reason)
    })
</script>
</body>
</html>